# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Spanner.V1.Model.Type do
  @moduledoc """
  `Type` indicates the type of a Cloud Spanner value, as might be stored in a table cell or returned from an SQL query.

  ## Attributes

  *   `arrayElementType` (*type:* `GoogleApi.Spanner.V1.Model.Type.t`, *default:* `nil`) - If code == ARRAY, then `array_element_type` is the type of the array elements.
  *   `code` (*type:* `String.t`, *default:* `nil`) - Required. The TypeCode for this type.
  *   `protoTypeFqn` (*type:* `String.t`, *default:* `nil`) - If code == PROTO or code == ENUM, then `proto_type_fqn` is the fully qualified name of the proto type representing the proto/enum definition.
  *   `structType` (*type:* `GoogleApi.Spanner.V1.Model.StructType.t`, *default:* `nil`) - If code == STRUCT, then `struct_type` provides type information for the struct's fields.
  *   `typeAnnotation` (*type:* `String.t`, *default:* `nil`) - The TypeAnnotationCode that disambiguates SQL type that Spanner will use to represent values of this type during query processing. This is necessary for some type codes because a single TypeCode can be mapped to different SQL types depending on the SQL dialect. type_annotation typically is not needed to process the content of a value (it doesn't affect serialization) and clients can ignore it on the read path.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :arrayElementType => GoogleApi.Spanner.V1.Model.Type.t() | nil,
          :code => String.t() | nil,
          :protoTypeFqn => String.t() | nil,
          :structType => GoogleApi.Spanner.V1.Model.StructType.t() | nil,
          :typeAnnotation => String.t() | nil
        }

  field(:arrayElementType, as: GoogleApi.Spanner.V1.Model.Type)
  field(:code)
  field(:protoTypeFqn)
  field(:structType, as: GoogleApi.Spanner.V1.Model.StructType)
  field(:typeAnnotation)
end

defimpl Poison.Decoder, for: GoogleApi.Spanner.V1.Model.Type do
  def decode(value, options) do
    GoogleApi.Spanner.V1.Model.Type.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Spanner.V1.Model.Type do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
